package com.ponhu.ea2.goodsCenter.provider.facade.impl;

import com.ponhu.ea2.goodsCenter.provider.service.InventoryService;
import com.ponhu.ea2.scmcenter.facade.bms.goods.GoodsCenterFacade;
import com.ponhu.ea2.scmcenter.model.dto.procurementoder.UpdateProductDto;
import com.ponhu.ea2.service.facade.GoodsCenterForPurchaseService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.cloud.context.config.annotation.RefreshScope;

import javax.annotation.Resource;

/**
 * @author luyu
 * @create 2022-01-07 14:57
 */
@RefreshScope
@Slf4j
@DubboService(version = "1.0.0", interfaceClass = GoodsCenterForPurchaseService.class, timeout = 6000)
public class GoodsCenterForPurchaseServiceImpl implements GoodsCenterForPurchaseService {

    @DubboReference(version = "1.0.0", check = false)
    GoodsCenterFacade goodsCenterFacade;

    @Resource
    private InventoryService inventoryService;

    @Override
    public void phInventoryUpdateToPurchase(Long inventoryId, String editName) {
        UpdateProductDto updateProductDto = inventoryService
                .getPhInventoryByIdForPurchase(inventoryId);
        updateProductDto.setUserName(editName);
        goodsCenterFacade.updateProcurementOrderProInfo(updateProductDto);
    }
}
